package com.sharedmobility.model;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.concurrent.TimeUnit;

public class Trip {
    private Integer id;
    private Integer userId;
    private Integer vehicleId;
    private Timestamp startTime;
    private String startLocation;
    private Timestamp endTime;
    private String endLocation;
    private BigDecimal distance;
    private BigDecimal cost;
    private Integer status;
    private Integer rating;
    private String comment;
    private Boolean paid;
    
    // 非数据库字段
    private Vehicle vehicle;

    // Getters and Setters
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(Integer vehicleId) {
        this.vehicleId = vehicleId;
    }

    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
    }

    public String getStartLocation() {
        return startLocation;
    }

    public void setStartLocation(String startLocation) {
        this.startLocation = startLocation;
    }

    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    public String getEndLocation() {
        return endLocation;
    }

    public void setEndLocation(String endLocation) {
        this.endLocation = endLocation;
    }

    public BigDecimal getDistance() {
        return distance;
    }

    public void setDistance(BigDecimal distance) {
        this.distance = distance;
    }

    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getRating() {
        return rating;
    }

    public void setRating(Integer rating) {
        this.rating = rating;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Boolean getPaid() {
        return paid;
    }

    public void setPaid(Boolean paid) {
        this.paid = paid;
    }
    
    // 获取关联的车辆信息
    public Vehicle getVehicle() {
        return vehicle;
    }
    
    // 设置关联的车辆信息
    public void setVehicle(Vehicle vehicle) {
        this.vehicle = vehicle;
    }
    
    // 获取行程时长（分钟）
    public Long getDurationMinutes() {
        if (startTime != null && endTime != null) {
            long durationMillis = endTime.getTime() - startTime.getTime();
            return TimeUnit.MILLISECONDS.toMinutes(durationMillis);
        }
        return null;
    }
} 